package com.kgc.storeconsumer.controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.storeconsumer.feign.StoreGoodSummaryFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RequestMapping("/StoreGoodSummary")
@RestController
public class StoreGoodSummaryController {
    private Logger logger = LoggerFactory.getLogger(StoreGoodSummaryController.class);

    @Autowired
    private StoreGoodSummaryFeign storeGoodSummaryFeign;

    @RequestMapping("selectSummaryByStoreGood")
    public ResponseMsg selectSummaryByStoreGood(@RequestBody Map<String, Object> map) {
        logger.info("StoreGoodSummaryController selectSummaryByStoreGood map:{}", map);
        return storeGoodSummaryFeign.selectSummaryByStoreGood(map);
    }

    @RequestMapping("selectAll")
    public ResponseMsg selectAll() {
        logger.info("StoreGoodSummaryController selectAll is start...");
        return storeGoodSummaryFeign.selectAll();
    }

    @RequestMapping("selectSummaryByGoodsTransactionDetail")
    public ResponseMsg selectSummaryByGoodsTransactionDetail(@RequestBody Map<String, Object> map) {
        logger.info("StoreGoodSummaryController selectSummaryByGoodsTransactionDetail map:{}", map);
        return storeGoodSummaryFeign.selectSummaryByGoodsTransactionDetail(map);
    }

    @RequestMapping("selectSummaryByBatchTrackingDetail")
    public ResponseMsg selectSummaryByBatchTrackingDetail(@RequestBody Map<String, Object> map) {
        logger.info("StoreGoodSummaryController selectSummaryByBatchTrackingDetail map:{}", map);
        return storeGoodSummaryFeign.selectSummaryByBatchTrackingDetail(map);
    }

//    @RequestMapping("updateStore")
//    public ResponseMsg updateStore(@RequestParam("gid") String gid, @RequestParam("sid") String sid, @RequestParam("stock") String stock) {
//        logger.info("StoreGoodSummaryController updateStore gid:{}", gid);
//        return storeGoodSummaryFeign.updateStore(Integer.parseInt(gid), Integer.parseInt(sid), Integer.parseInt(stock));
//    }

    @RequestMapping("method")
    public ResponseMsg method(@RequestBody Map<String, Object> map) {
        logger.info("StoreGoodSummaryController method map:{}", map);
        return storeGoodSummaryFeign.method(map);
    }

    @RequestMapping("selectKcStoreGoodBySidCid")
    public ResponseMsg selectKcStoreGoodBySidCid(@RequestParam("sid") String sid, @RequestParam("gid") String gid) {
        logger.info("StoreGoodSummaryController selectKcStoreGoodBySidCid sid:{},gid:{}", sid, gid);
        return storeGoodSummaryFeign.selectKcStoreGoodBySidCid(Integer.parseInt(sid), Integer.parseInt(gid));
    }

    @RequestMapping("getTotalInventoryCost")
    public ResponseMsg getTotalInventoryCost(){
        logger.info("StoreGoodSummaryController getTotalInventoryCost is start...");
        return storeGoodSummaryFeign.getTotalInventoryCost();
    }
}
